/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ru.ibrae.mchs.radiation.entities;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author murr
 */
@Entity
@Table(name = "dic_unit")
@NamedQueries({
    @NamedQuery(name = "DicUnit.findAll", query = "SELECT d FROM DicUnit d"),
    @NamedQuery(name = "DicUnit.findByIdUnit", query = "SELECT d FROM DicUnit d WHERE d.idUnit = :idUnit"),
    @NamedQuery(name = "DicUnit.findByUnitValue", query = "SELECT d FROM DicUnit d WHERE d.unitValue = :unitValue"),
    @NamedQuery(name = "DicUnit.findByKoeff", query = "SELECT d FROM DicUnit d WHERE d.koeff = :koeff")})
public class DicUnit implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_UNIT", nullable = false)
    private Integer idUnit;
    @Basic(optional = false)
    @Column(name = "UNIT_VALUE", nullable = false, length = 70)
    private String unitValue;
    @Basic(optional = false)
    @Column(name = "KOEFF", nullable = false)
    private int koeff;
    @OneToMany(mappedBy = "dicUnit")
    private Set<Result> resultSet;

    public DicUnit() {
    }

    public DicUnit(Integer idUnit) {
        this.idUnit = idUnit;
    }

    public DicUnit(Integer idUnit, String unitValue, int koeff) {
        this.idUnit = idUnit;
        this.unitValue = unitValue;
        this.koeff = koeff;
    }

    public Integer getIdUnit() {
        return idUnit;
    }

    public void setIdUnit(Integer idUnit) {
        this.idUnit = idUnit;
    }

    public String getUnitValue() {
        return unitValue;
    }

    public void setUnitValue(String unitValue) {
        this.unitValue = unitValue;
    }

    public int getKoeff() {
        return koeff;
    }

    public void setKoeff(int koeff) {
        this.koeff = koeff;
    }

    public Set<Result> getResultSet() {
        return resultSet;
    }

    public void setResultSet(Set<Result> resultSet) {
        this.resultSet = resultSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idUnit != null ? idUnit.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DicUnit)) {
            return false;
        }
        DicUnit other = (DicUnit) object;
        if ((this.idUnit == null && other.idUnit != null) || (this.idUnit != null && !this.idUnit.equals(other.idUnit))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "JPAtest.entities.DicUnit[idUnit=" + idUnit + "]";
    }

}
